﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class editNumberTypes : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        gvEditNumberType.FooterRow.FindControl("tbDescription_Insert").Focus();
        //form1.DefaultButton = gvEditNumberType.FooterRow.FindControl("btInsert").UniqueID;
    }

    protected void gvNumberType_Insert(object sender, EventArgs e)
    {
        TextBox tbDescription = (TextBox)gvEditNumberType.FooterRow.FindControl("tbDescription_Insert");
        CheckBox cbPhone = (CheckBox)gvEditNumberType.FooterRow.FindControl("cbPhone_Insert");
        CheckBox cbSMS = (CheckBox)gvEditNumberType.FooterRow.FindControl("cbSMS_Insert");
        CheckBox cbAlpha = (CheckBox)gvEditNumberType.FooterRow.FindControl("cbAlpha_Insert");
        CheckBox cbFax = (CheckBox)gvEditNumberType.FooterRow.FindControl("cbFax_Insert");

        dsNumberType.InsertParameters["Description"].DefaultValue = tbDescription.Text;
        dsNumberType.InsertParameters["Phone"].DefaultValue = cbPhone.Checked.ToString();
        dsNumberType.InsertParameters["SMSCapable"].DefaultValue = cbSMS.Checked.ToString();
        dsNumberType.InsertParameters["AlphaCapable"].DefaultValue = cbAlpha.Checked.ToString();
        dsNumberType.InsertParameters["Fax"].DefaultValue = cbFax.Checked.ToString();
        dsNumberType.Insert();
        gvEditNumberType.DataBind();
    }
}
